<?php


namespace app\test\controller;

use app\BaseController;
use iszsw\mock\annotation\illustrate\AutoValidate;
use iszsw\mock\annotation\illustrate\Route;
use iszsw\mock\annotation\illustrate\Mock;
use iszsw\mock\annotation\illustrate\MockPack;
use iszsw\mock\annotation\illustrate\WikiItem;
use iszsw\mock\annotation\illustrate\WikiMenu;

/**
 * @WikiMenu("测试")
 * @package app\controller
 * Author: zsw zswemail@qq.com
 */
class Test extends BaseController
{

    /**
     * @Route("test", method="GET")
     * @WikiItem("首页", description="首页详情")
     *
     * @AutoValidate({"username":"require|chsAlpha"}, message={"username":"请输入用户名"})
     * @Mock("username", mode="request", title="用户名", example="name")
     * @Mock("name", mode="response", title="名字", example="name", description="文章ID")
     */
    public function index($username){
        return "hello " . $username;
    }

    /**
     * @Route("mock", method="GET")
     * @WikiItem("详情", description="文章详情")
     *
     * @Mock("id", title="ID", example="numberBetween", description="文章ID")
     * @MockPack("articles", mode="response", title="文章列表", description="文章列表", limit=5)
     * @Mock("id", mode="response", title="ID", example="randomDigitNotNull", description="文章ID")
     * @Mock("title", mode="response", title="标题", example="name")
     * @Mock("create_time", mode="response", title="创建时间", example={"date": {"Y-m-d", "now"}})
     * @Mock("content", mode="response", title="内容", example={"sentence": 10})
     * @Mock("image", mode="response", title="图片", example="randomDigit")
     * @MockPack("user", main=true, mode="response", title="用户", description="发布者信息", limit=0)
     * @Mock("username", mode="response", title="用户名", example="name")
     * @MockPack("user")
     * @MockPack("articles")
     * @Mock("page", mode="response", title="页码", example="randomDigitNotNull", description="当前页码")
     */
    public function mock(){}
}